﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Admin/AdminMasterPage.master"
    AutoEventWireup="true" CodeFile="AdaugareProdus.aspx.cs" Inherits="Pages_Admin_AdaugareProdus" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table>
        <tr>
            <asp:Panel ID="Mesaj_success_panel" runat="server" Visible="false">
                <td align="center" bgcolor="#99FF66">
                    <asp:Label ID="Mesaj_succes_lb" runat="server" Text="Inserare cu succes" ForeColor="#0000CC"
                        Width="345 px"></asp:Label>
                </td>
            </asp:Panel>
            <asp:Panel ID="Mesaj_err_DB_panel" runat="server" Visible="false">
                <td align="center" bgcolor="#ff9966">
                    <asp:Label ID="Mesaj_err_DB_lb" runat="server" Text="Inserare nereusita! Eroare la inserare in baza de date!"
                        ForeColor="#0000CC" Width="345 px"></asp:Label>
                </td>
            </asp:Panel>
            <asp:Panel ID="Mesaj_err_insert_panel" runat="server" Visible="false">
                <td align="center" bgcolor="#ff9966">
                    <asp:Label ID="Mesaj_err_insert_lb" runat="server" ForeColor="#0000CC" Text="Nu se pot insera date deoarece anumite date apar existente in baza de date!"
                        Width="345 px"></asp:Label>
                </td>
            </asp:Panel>
        </tr>
        <tr>
            <asp:Panel ID="Panel1" runat="server">
                <td align="center">
                    <!-- if(!displayed == innerHTML==""){td.style.display=none; td.style.visibility=hidden;} -->
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" BackColor="#ff9966"
                        ForeColor="#0000CC" Width="345px" EnableClientScript="True" />
                </td>
            </asp:Panel>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label1" runat="server" Text="Numele produsului * "></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="ProductName_tb" runat="server" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ProductName_tb"
                                ErrorMessage="Introduceti numele produsului!" ForeColor="Red"
                                ToolTip="Introduceti numele produsului!">*</asp:RequiredFieldValidator>
                        </td>
                        <td rowspan="13">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label2" runat="server" Text="Pret *"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="Pret_tb" runat="server" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                ErrorMessage="Introduceti pretul produsului!"
                                ForeColor="Red" ControlToValidate="Pret_tb" ValidationGroup="pret"
                                ToolTip="Introduceti pretul produsului!">*</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="Pret_tb"
                                ErrorMessage="Pretul introdus este incorect!" ForeColor="Red" ValidationExpression="([0-9]*[.][0-9]*)|([0-9]*)$"
                                ValidationGroup="pret"
                                ToolTip="Pretul introdus este incorect!">*</asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label3" runat="server" Text="Descriere sumara"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="ShortDescription_tb" runat="server" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="PromotieValidator" runat="server" Enabled="false"
                                ErrorMessage="Promotiile necesita o descriere sumara" ForeColor="Red" ControlToValidate="ShortDescription_tb"
                                ToolTip="Promotiile necesita o descriere sumara">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label4" runat="server" Text="Descriere detaliata"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="DetailedDescription_tb" runat="server" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label5" runat="server" Text="Brand"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="Brand_ddl" runat="server" DataSourceID="SqlDataSource1" DataTextField="brand_name"
                                DataValueField="ID" Width="185px" AppendDataBoundItems="true">
                                <asp:ListItem Enabled="true" Selected="True" Text="Selecteaza o Firma" Value="0"></asp:ListItem>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:StoreDBConnectionString %>"
                                SelectCommand="SELECT * FROM [Brands]"></asp:SqlDataSource>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label6" runat="server" Text="Link Poze"></asp:Label>
                        </td>
                        <td>
                            <%--<asp:TextBox ID="LinkPoza" runat="server" Width="180px"></asp:TextBox>--%>
                            <asp:FileUpload ID="Poza1" runat="server" />
                            <br />
                            <asp:FileUpload ID="Poza2" runat="server" />
                            <br />
                            <asp:FileUpload ID="Poza3" runat="server" />
                            <br />
                            <asp:FileUpload ID="Poza4" runat="server" />
                        </td>
                        <td valign="top">
                            <asp:RequiredFieldValidator ID="SmallPictureValidator" runat="server" ErrorMessage="Introduceti o poza!"
                                ControlToValidate="Poza1" ForeColor="Red"
                                ToolTip="Introduceti o poza!">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label7" runat="server" Text="Categorie"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="Categorie_ddl" runat="server" DataSourceID="SqlDataSource2"
                                DataTextField="category_name" DataValueField="CategoryID" Width="185px"
                                AppendDataBoundItems="true">
                                <asp:ListItem Selected="True" Value="0">Selecteaza o categorie</asp:ListItem>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:StoreDBConnectionString %>"
                                SelectCommand="SELECT * FROM [Product_Categories]"></asp:SqlDataSource>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label8" runat="server" Text="Cod produs *"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="CodProdus_tb" runat="server" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="CodProdus_tb"
                                ErrorMessage="Introduceti codul produsului!" ForeColor="Red"
                                ToolTip="Introduceti codul produsului!">*</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="CodProdus_tb"
                                ErrorMessage="Codul produsului este format doar din cifre!" ForeColor="Red" ValidationExpression="[0-9]*$"
                                ToolTip="Codul produsului este format doar din cifre!">*</asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label9" runat="server" Text="Stoc Magazin *"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="StocMagazin_tb" runat="server" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="StocMagazin_tb"
                                ErrorMessage="Introduceti stocul din magazin!" ForeColor="Red"
                                ToolTip="Introduceti stocul din magazin!">*</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="StocMagazin_tb"
                                ErrorMessage="Stocul trebuie sa fie un numar intreg!" ForeColor="Red" ValidationExpression="[0-9]*$"
                                ToolTip="Stocul trebuie sa fie un numar intreg!">*</asp:RegularExpressionValidator>
                            <asp:RangeValidator ID="RangeValidator3" runat="server" ControlToValidate="StocMagazin_tb"
                                ErrorMessage="Stocul trebuie sa fie mai mare decat 0 si mai mic ca 3000000!"
                                ForeColor="Red" MaximumValue="3000000" MinimumValue="0" Type="Integer"
                                ToolTip="Stocul trebuie sa fie mai mare decat 0 si mai mic ca 3000000!">*</asp:RangeValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label10" runat="server" Text="Stoc furnizor *"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="StocFurnizor_tb" runat="server" Width="180px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="StocFurnizor_tb"
                                ErrorMessage="Introduceti stocul de produse de la furnizor!" ForeColor="Red"
                                ToolTip="Introduceti stocul de produse de la furnizor!">*</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="StocFurnizor_tb"
                                ErrorMessage="Stocul trebuie sa fie un numar intreg!" ForeColor="Red" ValidationExpression="[0-9]*$"
                                ToolTip="Stocul trebuie sa fie un numar intreg!">*</asp:RegularExpressionValidator>
                            <asp:RangeValidator ID="RangeValidator4" runat="server" ControlToValidate="StocFurnizor_tb"
                                ErrorMessage="Stocul trebuie sa fie mai mare decat 0 si mai mic ca 3000000!"
                                ForeColor="Red" MaximumValue="3000000" MinimumValue="0" Type="Integer"
                                ToolTip="Stocul trebuie sa fie mai mare decat 0 si mai mic ca 3000000!">*</asp:RangeValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label11" runat="server" Text="Disponibilitate"></asp:Label>
                        </td>
                        <td>
                            <asp:CheckBox ID="Disponibilitate_cb" runat="server" Checked="True" />
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Label ID="Label12" runat="server" Text="Este promotie"></asp:Label>
                        </td>
                        <td>
                            <asp:CheckBox ID="Promotie_cb" runat="server" Checked="false" onclick="ValidatorsEnabled(this.checked);" />
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <asp:Button ID="Button1" runat="server" Text="Insert" OnClick="Button1_Click1" />
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <script language="javascript" type="text/javascript">
     <!--
        function ValidatorsEnabled(state) {
            ValidatorEnable(document.getElementById('<%=PromotieValidator.ClientID%>'), state);
        }
    // -->
    </script>
</asp:Content>
